export const useOption = (type?: string) => {
  const getOptionList = async (api: (params: any) => Promise<any>) => {
    const res = await api({ offset: 0, limit: 10000 });
    console.log(res);

    const arr = Array.from(
      new Set(
        res.list?.map((item: any) => {
          return type == "name" ? item.equipment_name : item.equipment_location;
        })
      )
    );

    return arr.map((item) => {
      return { key: item, value: item };
    });
  };
  return { getOptionList };
};
